home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 43 / Mac Magazin and MacEasy Magazine CD - Issue 43.iso / Software / Mobiles Büro / Newton / Newton Sounds und Töne / VoiceToy 1.0 ƒ / VoiceToy.text < prev    next >
Text File  |  1997-12-04  |  7KB  |  254 lines

  1. // Text of project VoiceToy written on 12/4/97 at 1:24 PM
  2. // Beginning of file VoiceToyApp
  3. VoiceToyApp :=
  4.     {viewBounds: {left: 0, top: 10, right: 208, bottom: 314},
  5.      declareSelf: 'base,
  6.      _proto: @180 /* protoFloatNGo */
  7.     };
  8.  
  9. TextInput :=
  10.     {viewBounds: {left: 9, top: 25, right: 199, bottom: 167},
  11.      viewFlags: 33553921,
  12.      viewFont: editFont12,
  13.      viewFormat: 12625,
  14.      viewLineSpacing: 20,
  15.      viewClass: 81 /* clParagraphView */
  16.     };
  17. AddStepForm(VoiceToyApp, TextInput);
  18. StepDeclare(VoiceToyApp, TextInput, 'TextInput);
  19.  
  20.  
  21.  
  22. SayItButton :=
  23.     {
  24.      buttonClickScript:
  25.        func()
  26.        begin
  27.        // get the text from TextInput view
  28.        theText := self._parent.TextInput.text;
  29.        // play the text as a Macintalk sound using the chosen voice, rate, and pitch parameters
  30.        playsound(voice&rate&pitch&modulation&character&digit&theText);
  31.        end,
  32.      text: "Say It",
  33.      viewBounds: {left: 82, top: 279, right: 126, bottom: 299},
  34.      voice: "[[svox fred]]",
  35.      rate: "[[rate +000]]",
  36.      pitch: "[[pbas +000]]",
  37.      modulation: "\"\"",
  38.      character: "[[char nrml]]",
  39.      digit: "[[nmbr nrml]]",
  40.      _proto: @226 /* protoTextButton */
  41.     };
  42. AddStepForm(VoiceToyApp, SayItButton);
  43. StepDeclare(VoiceToyApp, SayItButton, 'SayItButton);
  44.  
  45.  
  46.  
  47. VoiceToyApp_v229_0 :=
  48.     {title: kAppName,
  49.      viewBounds: {left: 4, top: -8, right: 76, bottom: 16},
  50.      _proto: @229 /* protoTitle */
  51.     };
  52. AddStepForm(VoiceToyApp, VoiceToyApp_v229_0);
  53.  
  54.  
  55.  
  56. VoiceRate :=
  57.     {
  58.      changedSlider:
  59.        func()
  60.        begin
  61.        // grab the slider value and convert it to a string
  62.        local thevalue := numberstr(viewvalue);
  63.        // make sure you get the "+" sign in front of positive slider values
  64.        if viewvalue >= 0 then thevalue := "+"&thevalue;
  65.        // set the rate variable
  66.        self._parent.sayitbutton.rate := "[[rate "&thevalue&"]]";
  67.        end,
  68.      viewBounds: {left: 120, top: 195, right: 200, bottom: 206},
  69.      viewSetupFormScript:
  70.        func()
  71.        begin
  72.            // set the initial values for the slider
  73.            viewvalue := 0;
  74.        end,
  75.      viewValue: 0,
  76.      minValue: -500,
  77.      maxValue: 500,
  78.      _proto: @212 /* protoSlider */
  79.     };
  80. AddStepForm(VoiceToyApp, VoiceRate);
  81. StepDeclare(VoiceToyApp, VoiceRate, 'VoiceRate);
  82.  
  83.  
  84.  
  85. VoicePitch :=
  86.     {
  87.      changedSlider:
  88.        func()
  89.        begin
  90.        // grab the slider value and convert it to a string
  91.        local thevalue := numberstr(viewvalue);
  92.        // make sure the "+" sign is in front of positive slider values
  93.        if viewvalue >= 0 then thevalue := "+"&thevalue;
  94.        // set the pitch variable
  95.        self._parent.sayitbutton.pitch := "[[pbas "&thevalue&"]]";
  96.        end,
  97.      viewBounds: {left: 120, top: 233, right: 200, bottom: 244},
  98.      viewSetupFormScript:
  99.        func()
  100.        begin
  101.            // set the initial values for the slider
  102.            viewvalue := 0;
  103.        end,
  104.      viewValue: 0,
  105.      minValue: -20,
  106.      maxValue: 20,
  107.      _proto: @212 /* protoSlider */
  108.     };
  109. AddStepForm(VoiceToyApp, VoicePitch);
  110. StepDeclare(VoiceToyApp, VoicePitch, 'VoicePitch);
  111.  
  112.  
  113.  
  114. RateStaticText :=
  115.     {text: "- Rate +",
  116.      viewBounds: {left: 141, top: 208, right: 187, bottom: 224},
  117.      _proto: @218 /* protoStaticText */
  118.     };
  119. AddStepForm(VoiceToyApp, RateStaticText);
  120. StepDeclare(VoiceToyApp, RateStaticText, 'RateStaticText);
  121.  
  122.  
  123.  
  124. PitchStaticText :=
  125.     {text: "- Pitch +",
  126.      viewBounds: {left: 140, top: 246, right: 186, bottom: 262},
  127.      _proto: @218 /* protoStaticText */
  128.     };
  129. AddStepForm(VoiceToyApp, PitchStaticText);
  130. StepDeclare(VoiceToyApp, PitchStaticText, 'PitchStaticText);
  131.  
  132.  
  133.  
  134. InfoButton :=
  135.     {
  136.      buttonClickScript:
  137.        func()
  138.        begin
  139.        // display a notification slip with whatever information we want (yeah, it's a cheap way of doing an info button)
  140.        :notify(knotifyqalert,"VoiceToy 1.0","© 1997 Lee Moon.  All Rights Reserved.  Demo of using the Macintalk speech extensions on the Newton.");
  141.        end,
  142.      text: "i",
  143.      viewBounds: {left: 10, top: 288, right: 22, bottom: 300},
  144.      viewFont: fancyfont12+tsbold,
  145.      _proto: @226 /* protoTextButton */
  146.     };
  147. AddStepForm(VoiceToyApp, InfoButton);
  148. StepDeclare(VoiceToyApp, InfoButton, 'InfoButton);
  149.  
  150.  
  151.  
  152. VoicePicker :=
  153.     {
  154.      labelCommands:
  155.        ["Fred","Zarvox","Junior","Princess","Whisper","Kathy","Ralph","Good News","Bad News"]
  156.      ,
  157.      text: "Voice:",
  158.      viewBounds: {left: 9, top: 175, right: 128, bottom: 189},
  159.      alwaysCallPickActionScript: true,
  160.      pickActionScript:
  161.        func(itemSelected)
  162.        begin
  163.            sayitbutton.voice := voiceArray[itemselected];
  164.            inherited:?pickActionScript(itemSelected);        // this method is defined internally
  165.        end,
  166.      voiceArray:
  167.        ["[[svox fred]]","[[svox zarv]]","[[svox junr]]","[[svox prin]]","[[svox whis]]","[[svox kath]]","[[svox ralf]]","[[svox gnws]]","[[svox bnws]]"]
  168.      ,
  169.      _proto: @190 /* protoLabelPicker */
  170.     };
  171. AddStepForm(VoiceToyApp, VoicePicker);
  172. StepDeclare(VoiceToyApp, VoicePicker, 'VoicePicker);
  173.  
  174.  
  175.  
  176. ModulationCheckBox :=
  177.     {indent: 16,
  178.      text: "Monotone",
  179.      viewBounds: {left: 8, top: 198, right: 88, bottom: 214},
  180.      viewSetupFormScript:
  181.        func()
  182.        begin
  183.            self.indent := self.indent + StrFontWidth(self.text,self.viewFont);
  184.            inherited:?viewSetupFormScript();
  185.        end,
  186.      viewValue: nil,
  187.      valueChanged:
  188.        func()
  189.        begin
  190.        if viewvalue = true then sayitbutton.modulation := "[[pmod 0]]" else sayitbutton.modulation := "";
  191.        end,
  192.      viewFont: ROM_fontSystem9Bold,
  193.      _proto: @164 /* protoCheckBox */
  194.     };
  195. AddStepForm(VoiceToyApp, ModulationCheckBox);
  196. StepDeclare(VoiceToyApp, ModulationCheckBox, 'ModulationCheckBox);
  197.  
  198.  
  199.  
  200. LetterByLetterCheckBox :=
  201.     {indent: 16,
  202.      text: "Letter By Letter",
  203.      viewBounds: {left: 8, top: 217, right: 113, bottom: 233},
  204.      viewSetupFormScript:
  205.        func()
  206.        begin
  207.            self.indent := self.indent + StrFontWidth(self.text,self.viewFont);
  208.            inherited:?viewSetupFormScript();
  209.        end,
  210.      viewFont: ROM_fontSystem9Bold,
  211.      viewValue: nil,
  212.      valueChanged:
  213.        func()
  214.        begin
  215.        if viewvalue = true then sayitbutton.character := "[[char ltrl]]" else sayitbutton.character := "[[char nrml]]";
  216.        end,
  217.      _proto: @164 /* protoCheckBox */
  218.     };
  219. AddStepForm(VoiceToyApp, LetterByLetterCheckBox);
  220. StepDeclare(VoiceToyApp, LetterByLetterCheckBox, 'LetterByLetterCheckBox);
  221.  
  222.  
  223.  
  224. DigitByDigitCheckBox :=
  225.     {indent: 16,
  226.      text: "Digit By Digit",
  227.      viewBounds: {left: 8, top: 236, right: 97, bottom: 252},
  228.      viewSetupFormScript:
  229.        func()
  230.        begin
  231.            self.indent := self.indent + StrFontWidth(self.text,self.viewFont);
  232.            inherited:?viewSetupFormScript();
  233.        end,
  234.      viewFont: ROM_fontSystem9Bold,
  235.      viewValue: nil,
  236.      valueChanged:
  237.        func()
  238.        begin
  239.        if viewvalue = true then sayitbutton.digit := "[[nmbr ltrl]]" else sayitbutton.digit := "[[nmbr nrml]]";
  240.        end,
  241.      _proto: @164 /* protoCheckBox */
  242.     };
  243. AddStepForm(VoiceToyApp, DigitByDigitCheckBox);
  244. StepDeclare(VoiceToyApp, DigitByDigitCheckBox, 'DigitByDigitCheckBox);
  245.  
  246.  
  247.  
  248.  
  249. constant |layout_VoiceToyApp| := VoiceToyApp;
  250. // End of file VoiceToyApp
  251.  
  252.  
  253.  
  254.